<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>页面分析</title>
    <%@include file="../include/commonFile.jsp" %>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/analysis/page/list.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline"><label class="search-form-lable">页面名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="name" autocomplete="off" class="layui-input"
                                           value="${pageCount.name}" placeholder="请输入页面名称">
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <label class="search-form-lable">链&emsp;接</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="url" autocomplete="off" class="layui-input"
                                           value="${pageCount.url}" placeholder="请输入链接">
                                </div>
                            </li>

                            <li class="form-item-inline">
                                <label class="search-form-lable">合作机构</label>
                                <div class="layui-input-inline">
                                    <input type="hidden" name="partnerName" />
                                    <select name="partnerId" lay-search lay-filter="partnerId">
                                        <option value="">全部合作商</option>
                                        <c:forEach var="partner" items="${partnerList}">
                                            <option value="${partner.id}" <c:if test="${partner.id == pageCount.partnerId}">selected="selected"</c:if>>${partner.realname}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </li>

                            <li class="form-item-inline">
                                <label class="search-form-lable">模块名称</label>
                                <div class="layui-input-inline">
                                    <select name="module" lay-search lay-filter="">
                                        <option value="">所有模块</option>
                                        <c:forEach var="module" items="${modules}">
                                            <option value="${module.code}"
                                                    <c:if test="${module.code == pageCount.module}">selected="selected"</c:if>>${module.value}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">筛选日期</label>
                                <div class="check-btn-inner" id="timeType">
                                    <%--<a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${input.timeType == 1 ? 'class="active"' : ''}>今天</a>--%>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),2,'#myForm')" ${input.timeType == 2 ? 'class="active"' : ''}>昨天</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),3,'#myForm')" ${input.timeType == 3 ? 'class="active"' : ''}>最近7天</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),4,'#myForm')" ${input.timeType == 4 ? 'class="active"' : ''}>最近30天</a>
                                    <input type="hidden" name="timeType" value="${input.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart"
                                               value="${input.createStart}" placeholder="开始日">
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd"
                                               value="${input.createEnd}" placeholder="截止日">
                                    </div>
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger"
                                       href="javascript:submitFunctionNew('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal"
                                       href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="list-content">
                <div class="cl">
                    <table class="layui-table">
                        <colgroup>
                            <col/>
                            <col/>
                            <col/>
                            <col/>
                            <col/>
                            <col/>
                            <col/>
                        </colgroup>
                        <thead>
                        <tr>
                            <th>页面名称</th>
                            <th width="30%">页面网址</th>
                            <th>访问次数</th>
                            <th>访客数</th>
                            <th>跳出率</th>
                            <th>平均访问时长</th>
                            <th>机构名称</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="pageCount" items="${pageFlows}" varStatus="st">
                            <tr>
                                <td>${pageCount.name}</td>
                                <td>${pageCount.url}</td>
                                <td>${pageCount.pv}</td>
                                <td>${pageCount.uv}</td>
                                <td>${empty pageCount.outPercent?0:pageCount.outPercent}%</td>
                                <td>${pageCount.stayTime}</td>
                                <td>${pageCount.partnerName}</td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
            <div id="page_content" class="page-container"></div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '页面分析',
            curr: true
        }],
        info: '<span class="f12">共<b>${page.totalCount}</b>条记录',
        btns: []
    });

    $(function () {
//加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });
        //加载日历
        layui.use(['laydate'], function () {
            var laydate = layui.laydate;

            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]',
                done: function(value, date, endDate){
                    $(".check-btn-inner *").removeClass("active");
                    $("[name=timeType]").val("");
                }
            };

            var end = {
                elem: 'input[name=createEnd]',
                done: function(value, date, endDate){
                    $(".check-btn-inner *").removeClass("active");
                    $("[name=timeType]").val("");
                }
            };
            laydate.render(start);
            laydate.render(end);

            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]'
            };

            var end = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(start);
            laydate.render(end);
        });
    })
</script>
</body>
</html>